<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <?php
    
    
           $a = 3.14;
           $username = $_POST["username"];
           $userpass = $_POST["password"];
           
           echo $username;   
           echo $userpass;  
           
           
           
            //连接数据库
                  $conn = mysql_connect("localhost","root","root");
 
                  //选择数据库
                  mysql_select_db("shougong", $conn);
        
                  mysql_query("SET NAMES utf8");
 
  //获取界面传送的用户名和密码
  $username = $_POST['username'];
  $password = $_POST['password'];
  
                  //执行SQL语句
                  $sql = "select * from user where username='$username'";
                  $check_quary = mysql_query($sql);
 
                  //将查询到的结果写入$result
                  $result = array();
                  $result = mysql_fetch_assoc($check_quary);
 
                  //判断从前端获取的密码是否和数据库中的一样
                  //一样，则跳转到目标网页
                  if($password == $result['password']){
    
    
                ?>
                  <script>
                location = "index.html";
                  </script>
    
                  <?php
      
                  }
                  else{
    
                    ?>
    
                    <script>
                  alert("用户名，密码不正确");
                  location = "login4.html";
                    </script>
    
                    <?php
      
                  }
                  
  
      ?>
  
  
  
  </body>

</html>